VERSION 5.00
Begin VB.UserControl TouchScreenListBox 
   BackColor       =   &H00FFFFFF&
   BackStyle       =   0  'Transparent
   ClientHeight    =   2430
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   5160
   BeginProperty Font 
      Name            =   "Abadi MT Condensed Light"
      Size            =   8.25
      Charset         =   0
      Weight          =   300
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   ScaleHeight     =   2430
   ScaleWidth      =   5160
   Begin VB.ListBox Hidden_List 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   450
      Left            =   4320
      TabIndex        =   3
      Top             =   960
      Visible         =   0   'False
      Width           =   615
   End
   Begin VB.CommandButton List_Down 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4320
      Picture         =   "TouchScreenListBox.ctx":0000
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1560
      Width           =   855
   End
   Begin VB.CommandButton List_Up 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   855
      Left            =   4320
      Picture         =   "TouchScreenListBox.ctx":038A
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   0
      Width           =   855
   End
   Begin VB.ListBox Vis_List 
      BeginProperty Font 
         Name            =   "Abadi MT Condensed Light"
         Size            =   33.75
         Charset         =   0
         Weight          =   300
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2310
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   4215
   End
End
Attribute VB_Name = "TouchScreenListBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Dim TopOfList As Integer
Dim Counter As Integer
Dim ListElements As Integer

Public Event click()

Private Sub List_Down_Click()
   TopOfList = TopOfList + ListElements
   UpdateVisList
End Sub

Private Sub List_Up_Click()
   TopOfList = TopOfList - ListElements
   UpdateVisList
End Sub

Private Sub UserControl_Initialize()
   TopOfList = 0
End Sub

Private Sub UserControl_Resize()
   Vis_List.Width = ScaleWidth - 900
   Vis_List.Height = ScaleHeight
   Vis_List.Top = ScaleTop
   Vis_List.Left = ScaleLeft
   List_Up.Left = ScaleWidth - 855
   List_Down.Left = ScaleWidth - 855
   List_Down.Top = ScaleHeight - 900
   
'   ListElements = Round(UserControl.Height / 841, 0)
   ListElements = Round(UserControl.Height / 750, 0)
   
   TopOfList = 0
      
End Sub

Public Sub AddItem(ByVal StringItem As String)

   Hidden_List.AddItem StringItem
   UpdateVisList

End Sub

Public Function IsEmptyList() As Boolean
   If Vis_List.ListCount = 0 Then
       IsEmptyList = True
   Else
      IsEmptyList = False
   End If
End Function

Public Sub UpdateVisList()
   Dim Last_One As Integer
   
   If TopOfList + ListElements < Hidden_List.ListCount Then
      Last_One = ListElements - 1
   Else
      Last_One = Hidden_List.ListCount - TopOfList - 1
   End If
   Vis_List.Clear
  
   For Counter = 0 To Last_One
      Vis_List.AddItem Hidden_List.List(TopOfList + Counter)
   Next
   Update_Buttons

End Sub

Private Sub Update_Buttons()
   If Hidden_List.ListCount > ListElements Then
      If TopOfList = 0 Then
         List_Up.Enabled = False
      Else
         List_Up.Enabled = True
      End If
      If TopOfList >= Hidden_List.ListCount - ListElements Then
         List_Down.Enabled = False
      Else
         List_Down.Enabled = True
      End If
   Else
      List_Up.Enabled = False
      List_Down.Enabled = False
   End If
End Sub
Property Get Text() As String
   Text = Vis_List.Text
End Property
Property Get ListIndex() As Integer
    ListIndex = Vis_List.ListIndex + TopOfList
    
End Property
Property Let Enabled(ByVal EnableStatus As Boolean)
   Vis_List.Enabled = EnableStatus
   If EnableStatus = False Then
      List_Up.Enabled = EnableStatus
      List_Down.Enabled = EnableStatus
   End If
End Property

Private Sub Vis_List_Click()
'   List_Up.Enabled = False
'   List_Down.Enabled = False
'   Vis_List.Enabled = False
   RaiseEvent click
End Sub

Public Sub ClearList()
   Vis_List.Enabled = True
   TopOfList = 0
   UpdateVisList
End Sub

Public Sub DeleteList()
   TopOfList = 0
   Hidden_List.Clear
   Vis_List.Clear
   Update_Buttons
'   List_Up.Enabled = False
'   List_Down.Enabled = False
End Sub

Property Get ListCount()
   ListCount = Vis_List.ListCount
End Property

Property Get List(x) As String
   List = Vis_List.List(x)
End Property

Public Sub EnableScroll()
   List_Up.Enabled = True
   List_Down.Enabled = True
End Sub
